package org.sunshine.mamadu.gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.sunshine.mamadu.Advertisement;

public class AdvertisementDetailWindow {

    Shell internalShell;


    public AdvertisementDetailWindow(final Display display, Advertisement advertisement) {
        this.internalShell = new Shell(display, SWT.MIN + SWT.RESIZE);
        internalShell.setImage(MainFrame.getIcon());
        internalShell.setSize(300, 300);


        internalShell.setText(advertisement.getName() + " : " + advertisement.getPhone() + " : " + advertisement.getEmail() + " : " + advertisement.getDate());
        internalShell.setLayout(new FillLayout(SWT.VERTICAL));

        Text text = new Text(internalShell, SWT.MULTI | SWT.WRAP | SWT.LEFT);
        text.setBackground(new Color(display, MainFrame.DEFAULT_BACKROUND));

        text.setEditable(false);
        text.setText(advertisement.getContent());
        internalShell.open();
    }

}
